package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealOverViewVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface SetMealMapper {

    @Select("select count(1) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);

    List<Setmeal> getSetmealsByCondition(Setmeal setmeal);

    @Select("select * from setmeal where id = #{id}")
    Setmeal getById(Long setmealId);

    @AutoFill(OperationType.UPDATE)
    void updateById(Setmeal setmeal);

    Page<SetmealVO> pageQuerySetmealWithCategory(SetmealPageQueryDTO query);

    SetmealVO getSetmealWithDishesById(Long id);

    @AutoFill(OperationType.INSERT)
    void insert(Setmeal saveSetmeal);


    void deleteByIds(List<Long> ids);

    SetmealOverViewVO getOverviewSetmeals(LocalDateTime begin, LocalDateTime end);

}
